/*
 *E7_01.cpp
 *Create by Administrator
 * 2017年1月22日
 * 下午4:50:34
 * 抄的答案
 */
#include <iostream>
#include<string>
#include "Sales_data.h"
using std::cout;
using std::endl;
using std::cin;

int main() {
	Sales_data total;
	if (cin >> total.bookNo >> total.units_sold >> total.revenue) {
		Sales_data trans;
		while (cin >> total.bookNo >> total.units_sold >> total.revenue) {
			if (total.bookNo == trans.bookNo) {
				total.units_sold += trans.units_sold;
				total.revenue += trans.revenue;
			} else {
				cout << total.bookNo << " " << total.units_sold << " "
						<< total.revenue << endl;
				total = trans;
			}
		}
		cout << total.bookNo << " " << total.units_sold << " " << total.revenue
				<< endl;
	}else{
		std::cerr<<"No data?!"<<endl;
	}

	cout << " " << endl;
	return 0;
}
